# 简介 🐕🐕
主要用于调用TAPD api v2 接口的SDK<( ̄︶ ̄)↗[GO!]
推荐版本: NodeJs 14.13.0+
# 安装
设置npm工具使用软件源的registry
npm config set registry https://mirrors.tencent.com/npm/
1
安装SDK包
npm install @tencent/tapd-node-sdk
1
# 使用
# 申请应用
申请和使用应用 链接 (opens new window)
复制应用ID和密钥 https://o.tapd.woa.com/admin/{你的应用标识}/dashboard
# DEMO
const SDK = require('@tencent/tapd-node-sdk');
const api = new SDK({
client: 'gggg123', // 你的应用CODE
secret: '112A5B9F-D7B9-EC9C-B688-24E44F5043C4', // 密钥 注意保密
});
// api 详细文档可参考tapdAPI的文档
api.getStories({
workspace_id: '755'
}).then(data => {
console.log(data);
}).catch(e => console.log(e));
// 文件上传接口使用方式
var file = fs.createReadStream('your file path')
// 支持Buffer
// const {FILE}= require('@tencent/tapd-node-sdk');
// const { Readable } = require('stream');
// //Readable
// const file_stdout = Readable.from(bitmap);
// var file = new FILE({
// stdout: file_stdout,
// filename: 'test.jpg',
// });
api.uploadImage({
workspace_id: "755",
image: file
}).then(data => {
console.log(data);
}).catch(e => console.log(e));
api.uploadImage({
workspace_id: "755",
image: file
}).then(data => {
console.log(data);
}).catch(e => console.log(e));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 查看所有SDK方法和参数 (opens new window)
# Artifact
https://mirrors.tencent.com/#/private/npm/detail?repo_id=537&project_name=%40tencent%2Ftapd-node-sdk&search_label=package_name&search_value=tapd-node-sdk&page_num=1
# 常见问题
# IDC网络问题
使用SDK调用API无法响应,可查看自己是否处于IDC网络链接 (opens new window)
IDC环境下的SDK设置:
const SDK = require('@tencent/tapd-node-sdk');
const api = new SDK({
client: 'gggg123', // 你的应用CODE
secret: '112A5B9F-D7B9-EC9C-B688-24E44F5043C4', // 密钥 注意保密
env: 'idc'
});
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# Contributions
欢迎参与SDK共建!开发&共建流程,请参照 contributing.md (opens new window)。
← Golang-SDK Python-SDK →